package com.thj.dao.impl;

import java.util.ArrayList;
import java.util.List;

import com.commons.po.RolePo;
import com.dao.BaseDao;
import com.thj.dao.RoleDao;
import com.thj.dao.UserRoleDao;
import com.thj.po.UserRolePo;

public class UserRoleDaoImpl implements UserRoleDao {

	@Override
	public List<RolePo> findRoleById(Integer userId) {
		List<RolePo> list = new ArrayList<RolePo>();
		RoleDao roleDao = new RoleDaoImpl();
		String sql = " select * from user_role where user_id=?";
		BaseDao baseDao = new BaseDao();
		List<UserRolePo> list1 = baseDao.executeQuery(sql, null, UserRolePo.class, userId);
		for(UserRolePo i: list1){
			list.add(roleDao.findbyId(i.getRoleId()));
			System.out.println(i.getRoleId());
		}
		
		return list;
	}

}
